import Vue from 'vue'
import VueRouter from 'vue-router'
import PATH from "./constant"

Vue.use(VueRouter)

const routes = [
  {
    path: PATH.HOME,
    name: 'home',
    meta:{
      isShowNav:false,
      isShowTab:true,
      title:'主页',
    },
    component: () => import('../views/home.vue')
  },
  {
    path: PATH.CLASSIFY,
    name: 'classify',
    meta:{
      isShowNav:false,
      isShowTab:true,
      title:'分类',
    },
    component: () => import('../views/classify.vue')
  },
  {
    path: PATH.SHOPCAR,
    name: 'shopcar',
    meta:{
      isShowNav:false,
      isShowTab:true,
      title:'购物车',
    },
    component: () => import('../views/shopcar.vue')
  },
  {
    path: PATH.PERSONAGE,
    name: 'personage',
    meta:{
      isShowNav:false,
      isShowTab:true,
      title:'个人',
    },
    component: () => import('../views/personage.vue')
  },
  {
    path: PATH.LOGIN,
    name: 'login',
    meta:{
      isShowNav:true,
      isShowTab:false,
      title:'登录页',
    },
    component: () => import('../views/pages/login.vue')
  },
  {
    path: PATH.REG,
    name: 'reg',
    meta:{
      isShowNav:true,
      isShowTab:false,
      title:'注册页',
    },
    component: () => import('../views/pages/reg.vue')
  },
  {
    path: PATH.DISCOUNTS,
    name: 'discounts',
    meta:{
      isShowNav:true,
      isShowTab:false,
      title:'优惠券',
    },
    component: () => import('../views/pages/discounts.vue')
    
  },
  {
    path: PATH.BARGAINLIST,
    name: 'bargainlist',
    meta:{
      isShowNav:true,
      isShowTab:false,
      title:'列表',
    },
    component: () => import('../views/pages/bargainlist.vue')
  },
  {
    path: PATH.NEWS,
    name: 'news',
    meta:{
      isShowNav:true,
      isShowTab:false,
      title:'文章列表',
    },
    component: () => import('../views/pages/news.vue')
  },
  {
    path: PATH.NEWSDETAILS,
    name: 'newsdetails',
    meta:{
      isShowNav:true,
      isShowTab:false,
      title:'文章详情',
    },
    component: () => import('../views/pages/newsdetails.vue')
  },
  {
    path: PATH.CLASSIFYDETAILS,
    name: 'classifydetails',
    meta:{
      isShowNav:true,
      isShowTab:false,
      title:'分类商品',
    },
    component: () => import('../views/pages/classifydetails.vue')
  },
  {
    path: PATH.BARGAINDETAIL,
    name: 'bargaindetail',
    meta:{
      isShowNav:false,
      isShowTab:false,
      title:'商品详情',
    },
    component: () => import('../views/pages/bargaindetail.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
